﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Jy123.Web.Manage.User
{
    public partial class GroupMng :MgConfig// System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Verify("GroupMng.aspx");
            string type = Request.QueryString["Type"];
            if (type == "del")
            {
                string id = Request.QueryString["id"];
                new BLL.User.Group().DelGroup(int.Parse(id));
            }
            //绑定分页
            Jy123.Model.MPagination mPagination = new Jy123.Model.MPagination();
            mPagination.Tables = "V_User_GroupList";
            mPagination.PrimaryKey = "ID";
            mPagination.Fields = "*";
            mPagination.CurrentPage = 0;
            mPagination.Filter = string.Empty;
            mPagination.PageSize = 30;
            mPagination.Sort = "ID DESC";
            mPagination.Group = string.Empty;
            Rpt_GroupList.DataSource = BLL.Public.Pagination.GetList(mPagination);
            Rpt_GroupList.DataBind();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Jy123.Model.MPagination mPagination = new Jy123.Model.MPagination();
            mPagination.Tables = "V_User_GroupList";
            mPagination.PrimaryKey = "ID";
            mPagination.Fields = "*";
            mPagination.CurrentPage = 0;
            if (txtSearch.Text.Trim() == "")
            {
                mPagination.Filter = string.Empty;
            }
            else
            {
                mPagination.Filter = "GroupName=" + txtSearch.Text; 
            }            
            mPagination.PageSize = 30;
            mPagination.Sort = "ID DESC";
            mPagination.Group = string.Empty;
            Rpt_GroupList.DataSource = BLL.Public.Pagination.GetList(mPagination);
            Rpt_GroupList.DataBind();
        }
    }
}
